﻿namespace WLFramework.Validation
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public sealed class ValidationContext
    {
        public Func<string, string> GetDisplayName { get; set; }
        public Func<string, object> GetValue { get; set; }

        public ValidationContext()
        {
        }

        public object Value { get; set; }
        public string MemberName { get; set; }
        public string DisplayName { get; set; }

        public bool IsNull(object input)
        {
            return input == null ||
                   input == DBNull.Value ||
#if FW4
                   string.IsNullOrWhiteSpace(input.ToString());
#else
                   string.IsNullOrEmpty(input.ToString().Trim());
#endif
        }
    }
}
